<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Blog</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">
  <!-- 先引入 Vue -->
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
  <!-- 引入组件库 -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
<body>

<header>
<h1><%= title %></h1>
	<div>
		欢迎你，
		<% if (user) { %>
			<%= user.name %>
		<% } else { %>
			游客，请登录。
		<% } %>
	</div> 
</header>

<nav>
<span><a title="主页" href="/">home</a></span>
<% if (user) { %>
  <span><a title="发表" href="/post">post</a></span>
  <span><a title="登出" href="/logout">logout</a></span>
<% } else { %>
  <span><a title="登录" href="/login">login</a></span>
  <span><a title="注册" href="/reg">register</a></span>
<% } %>
</nav>

<article>
<div id="status">
<% if (success) { %>
		<template>
			<el-alert title="<%= success %>" type="success" show-icon></el-alert>
		</template>
<% } %>
<% if (error) { %>
  	<%= error %></div>
<% } %>
</div>
<script type="text/javascript">
	new Vue().$mount('#status');
</script>